/* Copyright (C) 2010 Luca Piccinelli
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/* 
 * File:   AbstractFileGenerator.h
 * Author: picci
 *
 * Created on January 1, 2011, 7:18 PM
 */

#ifndef ABSTRACTFILEGENERATOR_H
#define	ABSTRACTFILEGENERATOR_H

#include "generators/resource/AbstractResourceGenerator.h"

#include "boost/filesystem.hpp"

#include <string>

namespace NAMESPACE{

class AbstractFileGenerator : public AbstractResourceGenerator{
public:
    using AbstractGenerator::generate;
    using AbstractGenerator::set_key;
protected:
    virtual void free_element(IOElement* el) = 0;
    virtual memory_size_t measure_memory() = 0;

public:
    virtual ~AbstractFileGenerator();
    AbstractFileGenerator();
    AbstractFileGenerator(const AbstractFileGenerator& g);
    AbstractFileGenerator& operator=(const AbstractFileGenerator& g);

    AbstractFileGenerator(const std::string& _resource,
                          const memory_size_t& _max_mem = AbstractGenerator::DEFAULT_MAX_MEM_SIZE);
    AbstractFileGenerator(const IOKey& k,
                          const memory_size_t& _max_mem = AbstractGenerator::DEFAULT_MAX_MEM_SIZE);
    AbstractFileGenerator(const std::string& _resource,
                          const IOKey& k,
                          const memory_size_t& _max_mem = AbstractGenerator::DEFAULT_MAX_MEM_SIZE);

    virtual Generator& set_key(const std::string& ns, const std::string& key_name) = 0;

    virtual AbstractFileGenerator& open();
    virtual AbstractFileGenerator& close();

    virtual IOElement* generate(const IOKey& key) = 0;
};

}

#endif	/* ABSTRACTFILEGENERATOR_H */

